home *** CD-ROM | disk | FTP | other *** search
/ H4CK3R 14 / hacker14.iso / programacao / visual / perl.exe / {app} / CVSGotoline.pl < prev    next >
Encoding:
Text File  |  2003-01-11  |  684 b   |  32 lines

  1. # Get the active line. The format used to send
  2. # is linenumber<tab>activefilename
  3. # linenumber is 0 indexed.
  4.  
  5. ($linenum,$activefilename) = split(/\t/,<STDIN>);
  6.  
  7. # Get input from OptiPerl.
  8. @lines = <STDIN>;
  9.  
  10. # the first line of the output should containt
  11. # the file used for diff
  12.  
  13. die unless ($lines[0]=~/Index: (\S+)/);
  14. $difffile = $1;
  15.  
  16. # Now starting from the the active line in the
  17. # editor and going backwards, find something
  18. # like "--- 10,30"
  19.  
  20. while ($linenum >= 0) {
  21.  
  22.  if ($lines[$linenum]=~/^--- (\d+),(\d+)/)
  23.  {
  24.   # print now the line we want to go to in the
  25.   # file we want to go to:
  26.   print $1 - 1 . "\t$difffile";
  27.   exit;
  28.  }
  29.  $linenum--;
  30. }
  31.  
  32.